13:51:26 SYS@ boston> select * from nls_database_parameters;
PARAMETER VALUE ------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET AL32UTF8 NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_RDBMS_VERSION 11.2.0.4.0
提示要修改的新的字符集必须大于旧的字符集才可以
1 2 3 4 5
13:51:36 SYS@ boston> ALTER DATABASE CHARACTER SET ZHS16GBK; ALTER DATABASE CHARACTER SET ZHS16GBK * ERROR at line 1: ORA-12712: new character set must be a superset of old character set
跳过超集的检查
1 2 3 4 5 6 7 8
13:59:34 SYS@ boston> alter system enable restricted session; System altered. Elapsed: 00:00:02.05 13:59:48 SYS@ boston> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; ALTER DATABASE character set INTERNAL_USE ZHS16GBK * ERROR at line 1: ORA-12721: operation cannot execute when other sessions are active
14:06:46 SYS@ boston> alter system kill session '207,145'; System altered. Elapsed: 00:00:00.00 14:07:11 SYS@ boston> alter system kill session '306,199'; System altered.
14:07:27 SYS@ boston> select sid, serial#,program ,status from v$session;
SID SERIAL# PROGRAM STATUS ---------- ---------- ------------------------------------------------------------------------------------------------ ---------------- 1 1 oracle@dax-mysql-slave (VKTM) ACTIVE 2 1 oracle@dax-mysql-slave (DIA0) ACTIVE 3 1 oracle@dax-mysql-slave (CKPT) ACTIVE 4 3 oracle@dax-mysql-slave (MMNL) ACTIVE 6 11 oracle@dax-mysql-slave (SMCO) ACTIVE 101 1 oracle@dax-mysql-slave (GEN0) ACTIVE 102 1 oracle@dax-mysql-slave (MMAN) ACTIVE 103 1 oracle@dax-mysql-slave (SMON) ACTIVE 105 1603 sqlplus@dax-mysql-slave (TNS V1-V3) ACTIVE 201 1 oracle@dax-mysql-slave (PMON) ACTIVE 202 1 oracle@dax-mysql-slave (DIAG) ACTIVE 203 1 oracle@dax-mysql-slave (DBW0) ACTIVE 204 1 oracle@dax-mysql-slave (RECO) ACTIVE 207 145 sqlplus@dax-mysql-slave (TNS V1-V3) KILLED 302 1 oracle@dax-mysql-slave (PSP0) ACTIVE 303 1 oracle@dax-mysql-slave (DBRM) ACTIVE 304 1 oracle@dax-mysql-slave (LGWR) ACTIVE 305 3 oracle@dax-mysql-slave (MMON) ACTIVE 306 199 sqlplus@dax-mysql-slave (TNS V1-V3) KILLED
再次执行仍然提示有活动会话
1 2 3 4 5
14:07:29 SYS@ boston> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; ALTER DATABASE character set INTERNAL_USE ZHS16GBK * ERROR at line 1: ORA-12721: operation cannot execute when other sessions are active
Total System Global Area 1603411968 bytes Fixed Size 2253664 bytes Variable Size 503319712 bytes Database Buffers 1090519040 bytes Redo Buffers 7319552 bytes Database mounted. Database opened. 14:11:46 SYS@ boston> select sid, serial#,program ,status from v$session; SID SERIAL# PROGRAM STATUS ---------- ---------- ------------------------------------------------------------------------------------------------ ---------------- 1 1 oracle@dax-mysql-slave (VKTM) ACTIVE 2 1 oracle@dax-mysql-slave (DIA0) ACTIVE 3 1 oracle@dax-mysql-slave (CKPT) ACTIVE 4 1 oracle@dax-mysql-slave (MMNL) ACTIVE 101 1 oracle@dax-mysql-slave (GEN0) ACTIVE 102 1 oracle@dax-mysql-slave (MMAN) ACTIVE 103 1 oracle@dax-mysql-slave (SMON) ACTIVE 201 1 oracle@dax-mysql-slave (PMON) ACTIVE 202 1 oracle@dax-mysql-slave (DIAG) ACTIVE 203 1 oracle@dax-mysql-slave (DBW0) ACTIVE 204 1 oracle@dax-mysql-slave (RECO) ACTIVE 301 5 sqlplus@dax-mysql-slave (TNS V1-V3) ACTIVE 302 1 oracle@dax-mysql-slave (PSP0) ACTIVE 303 1 oracle@dax-mysql-slave (DBRM) ACTIVE 304 1 oracle@dax-mysql-slave (LGWR) ACTIVE 305 1 oracle@dax-mysql-slave (MMON) ACTIVE 16 rows selected.
Elapsed: 00:00:00.03 14:11:47 SYS@ boston> alter system enable restricted session; System altered. Elapsed: 00:00:02.04 14:12:00 SYS@ boston> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; Database altered.
15:01:20 SYS@ boston> select * from nls_database_parameters;
PARAMETER VALUE ------------------------------ -------------------------------------------------------------------------------- NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET ZHS16GBK NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_RDBMS_VERSION 11.2.0.4.0 20 rows selected. 15:05:51 SYS@ boston> alter system enable restricted session; System altered. Elapsed: 00:00:02.06 15:07:05 SYS@ boston> ALTER DATABASE character set AL32UTF8; ALTER DATABASE character set AL32UTF8 * ERROR at line 1: ORA-12712: new character set must be a superset of old character set Elapsed: 00:00:00.00
15:07:12 SYS@ boston> ALTER DATABASE character set INTERNAL_USE AL32UTF8; ALTER DATABASE character set INTERNAL_USE AL32UTF8 * ERROR at line 1: ORA-12721: operation cannot execute when other sessions are active